package day01.file;

import java.io.File;

/**
 * @ClassName DeleteDirDemo
 * @Description TODO
 * @Author 16433
 * @Date 2023/3/6 16:29
 * @Version 1.0
 *
 * 删除一个目录
 **/
public class DeleteDirDemo {
    public static void main(String[] args) {
        File dir = new File("./demo");
        if(dir.exists()){
            /*
            * delete删除目录时,如果目录中有数据,则不能删除,只能删除空目录
            * */
            dir.delete();
            System.out.println("该目录已删除");
        }else {
            System.out.println("该目录不存在");
        }
    }
}
